Skip to content

Large files read in full; empty writes over real files refused; no-op fix cycles stall - #235

Merged
nambok merged 1 commit into
mainfrom
fix/large-file-reads
Oct 22, 2026
Merged

nambok merged 1 commit into
mainfrom
fix/large-file-reads

Conversation

@nambok

@nambok nambok commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

GitHub's contents API returns no content for files over 1 MB. read_file returned "" as success, so the merge step and restore_file wrote an empty lockfile, and eight CI fix cycles kept rewriting it empty without the stall check firing.

Changes

  • github.rs: read_file/read_file_live fall back to /git/blobs/{sha} when size > 0 but content is missing; still empty → Err, never "". Directory paths error. New read_file_if_exists (Ok(None) only on 404) and metadata-only file_exists.
  • write_file, batch_write and create_merge_commit refuse blank content over a non-empty file (error names path + size).
  • pr.rs resolve_conflicts: a failed read stops the merge instead of being treated as 'deleted on base'.
  • mod.rs: lockfile presence checks use file_exists (no multi-MB downloads).
  • resume.rs: branch tree recorded before/after each CI fix; an unchanged or revisited tree counts as a stall, even when the failing-workflow signature changes.

Verification

  • cargo fmt, clippy -D warnings clean.
  • cargo test common/worker/gateway: 408 / 156 / 489 pass; new tests cover the 1.2 MB encoding:none response, empty blob errors, empty-overwrite refusal, no-op and revisited-tree stalls.

@nambok
nambok merged commit e32b8b0 into main Oct 22, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant